import java.util.Arrays;

public class Test {

    /*public static String add(int[] array, int target){
        String str = "[";
        for (int i = 0; i < array.length; i++) {
            for (int j = i + 1; j < array.length; j++) {
                if(array[i] + array[j] == target){
                    str =str + i + "," + j;
                    str += "]";

                    break;
                }
            }
        }
        return str;
    }

    public static void main(String[] args) {
        int[] array = {2,4,9,8,5};
        int target = 6;
        String ret = add(array, target);
        System.out.println(ret);
    }*/

    /*public static int onceNumber(int[] array){
        int count = 0;
        for (int i = 0; i < array.length; i++) {
            for (int j = 0; j < array.length; j++) {
                if(array[i] == array[j]){
                    count++;
                }
            }
            if(count == 1){
                return array[i];
            }
        }
        return -1;
    }


    public static void main(String[] args) {
        int[] array = {2,2,3,5,5,6,6};
        int ret = onceNumber(array);
        System.out.println(ret);
    }

}*/

    /*public static int onceNumber(int[] array){
        int ret = 0;
        for (int i = 0; i < array.length; i++) {
            ret ^= array[i];
        }
        return ret;
}

    public static void main(String[] args) {
        int[] array = {2, 2, 3, 5, 5, 6, 6};
        int ret = onceNumber(array);
        System.out.println(ret);
    }*/

    /*public static int func(int[] array){
        Arrays.sort(array);
        return array[array.length/2];
    }

    public static void main(String[] args) {
        int[] array = new int[]{2,2,1,1,1,2,2};
        int ret = func(array);
        System.out.println(ret);
    }*/

    /*public static boolean func(int[] arr){
        int count = 0;
        for (int i = 0; i < arr.length; i++) {
            if(arr[i] % 2 != 0){
                count++;
                if(count == 3){
                    return true;
                }
            } else {
                count = 0;
            }
        }
        return false;
    }

    public static void main(String[] args) {
        int[] arr = new int[]{1,2,34,3,4,5,7,23,12};
        boolean ret = func(arr);
        System.out.println(ret);

    }*/

    public static void func(int[] array){
        int left = 0;
        int right = array.length-1;
        while (left < right){
            while (left < right && array[left] % 2 != 0){
                left++;

            }
            while (left < right && array[right] % 2 == 0){
                right--;
            }
            swap(array, left, right);

        }
    }

    public static void swap(int[] array, int left, int right){
                int tmp = array[left];
                array[left] = array[right];
                array[right] = tmp;
    }

    public static void main(String[] args) {
        int[] array = new int[]{1,2,3,4,5,6};
        func(array);
        System.out.println(Arrays.toString(array));

    }


}






